package org.summerframework.component.security.session.service.impl;

import org.summerframework.component.security.LoginData;
import org.summerframework.component.security.core.service.SessionService;
import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

/**
 * @author 石超
 * @version v1.0.0
 */
@Service
public class SessionServiceImpl implements SessionService {
    @Override
    public void complete(HttpSession session, LoginData loginData) {
        session.setAttribute(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, String.valueOf(loginData.getUserId()));
    }
}
